#include<bits/stdc++.h>
using namespace std;
const int N = 2010;
int f[N][N],r,n,ans,ans1,mi;
string s,s1;
signed main()
{
	freopen("hard.in","r",stdin);
	freopen("hard.out","w",stdout);
	cin >> n >> s >> s1;
	s = ' '+s,s1 = ' '+s1;
	if(s == s1)
	{
		cout<<0;
		return 0;
	}
	mi = n; ans = 1;
	for(int i = 1;i <= n;i++)
		if(s[i] == s1[i]) 
			ans++;
	mi = min(mi,ans);
	ans = ans1 = 0;
	for(int i = 2;i <= n;i++)
		if(s1[i] != s1[i-1] && s1[i-1] == '0') 
			ans++;
		else if(s1[i] != s1[i-1] && s1[i-1] == '1') 
			ans1++;
	if(s1[n] == '0') ans++;
	else ans1++;
	mi = min(mi,min(1+ans,1+ans1));
	printf("%d",mi);
	return 0;
}
